function HistoryRouter() {
    BaseRouter.call(this);
}

HistoryRouter.prototype = new BaseRouter;

HistoryRouter.prototype.constructor = HistoryRouter;

HistoryRouter.prototype.init = function () {
    var _that = this;
    this.router.subscribe('routerChange', function (e) {
        var fullUrl = e.href.replace(e.origin, '');
        var fullpath = e.pathname;
        var path = _that.getRoutePath(fullpath);
        _that.router.publish('*', fullUrl);
        _that.publish(path, fullUrl);
    });

    window.addEventListener('popstate', function (e) {
        publishRouter();
    });

    var originPushState = window.history.pushState;
    var originReplaceState = window.history.replaceState;
    window.history.pushState = function () {
        originPushState.apply(window.history, arguments);
        publishRouter();
    };

    window.history.replaceState = function () {
        originReplaceState.apply(window.history, arguments);
        publishRouter();
    }


    function publishRouter() {
        _that.router.publish('routerChange', window.location);
    }

    publishRouter();

    this.addLinkEvent();
}


HistoryRouter.prototype.jumpTo = function jumpTo(path) {
    if (path === '/') {
        return false;
    }
    window.history.pushState(null, null, '/' + path);
}